{
  "sources": {
    "cluster_logging_config/test-source:tests-whispers": {
      "type": "kubernetes_logs",
      "extra_label_selector": "app=test,log-shipper.deckhouse.io/exclude notin (true),tier in (cache)",
      "extra_field_selector": "metadata.namespace=tests-whispers,metadata.name!=$VECTOR_SELF_POD_NAME",
      "extra_namespace_label_selector": "log-shipper.deckhouse.io/exclude notin (true)",
      "annotation_fields": {
        "container_image": "image",
        "container_name": "container",
        "pod_ip": "pod_ip",
        "pod_labels": "pod_labels",
        "pod_name": "pod",
        "pod_namespace": "namespace",
        "pod_node_name": "node",
        "pod_owner": "pod_owner"
      },
      "node_annotation_fields": {
        "node_labels": "node_labels"
      },
      "glob_minimum_cooldown_ms": 1000,
      "use_apiserver_cache": true
    }
  },
  "transforms": {
    "transform/destination/test-es-dest/00_elastic_dedot": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-source/09_log_filter"
      ],
      "source": "if exists(.pod_labels) {\n    .pod_labels = map_keys(object!(.pod_labels), recursive: true) -\u003e |key| { replace(key, \".\", \"_\") }\n}",
      "type": "remap"
    },
    "transform/destination/test-es-dest/01_extra_fields": {
      "drop_on_abort": false,
      "inputs": [
        "transform/destination/test-es-dest/00_elastic_dedot"
      ],
      "source": "if !exists(.parsed_data) {\n    structured, err = parse_json(.message)\n    if err == null {\n        .parsed_data = structured\n    } else {\n        .parsed_data = .message\n    }\n}\n\nif exists(.parsed_data.\"X-Device-Id\") { .\"X-Device-Id\"=.parsed_data.\"X-Device-Id\" } \n .\"X-Device-Version\"=\"X-Device-Version\" \n if exists(.parsed_data.ap_p[0].a) { .app=.parsed_data.ap_p[0].a } \n .foo=\"bar\"",
      "type": "remap"
    },
    "transform/destination/test-es-dest/02_del_parsed_data": {
      "drop_on_abort": false,
      "inputs": [
        "transform/destination/test-es-dest/01_extra_fields"
      ],
      "source": "if exists(.parsed_data) {\n    del(.parsed_data)\n}",
      "type": "remap"
    },
    "transform/source/test-source/00_owner_ref": {
      "drop_on_abort": false,
      "inputs": [
        "cluster_logging_config/test-source:tests-whispers"
      ],
      "source": "if exists(.pod_owner) {\n    .pod_owner = string!(.pod_owner)\n\n    if starts_with(.pod_owner, \"ReplicaSet/\") {\n        hash = \"-\"\n        if exists(.pod_labels.\"pod-template-hash\") {\n            hash = hash + string!(.pod_labels.\"pod-template-hash\")\n        }\n\n        if hash != \"-\" \u0026\u0026 ends_with(.pod_owner, hash) {\n            .pod_owner = replace(.pod_owner, \"ReplicaSet/\", \"Deployment/\")\n            .pod_owner = replace(.pod_owner, hash, \"\")\n        }\n    }\n\n    if starts_with(.pod_owner, \"Job/\") {\n        if match(.pod_owner, r'-[0-9]{8,11}$') {\n            .pod_owner = replace(.pod_owner, \"Job/\", \"CronJob/\")\n            .pod_owner = replace(.pod_owner, r'-[0-9]{8,11}$', \"\")\n        }\n    }\n}",
      "type": "remap"
    },
    "transform/source/test-source/01_clean_up": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-source/00_owner_ref"
      ],
      "source": "if exists(.pod_labels.\"controller-revision-hash\") {\n    del(.pod_labels.\"controller-revision-hash\")\n}\nif exists(.pod_labels.\"pod-template-hash\") {\n    del(.pod_labels.\"pod-template-hash\")\n}\nif exists(.kubernetes) {\n    del(.kubernetes)\n}\nif exists(.file) {\n    del(.file)\n}\nif exists(.node_labels.\"node.deckhouse.io/group\") {\n\t.node_group = (.node_labels.\"node.deckhouse.io/group\")\n}\ndel(.node_labels)",
      "type": "remap"
    },
    "transform/source/test-source/02_local_timezone": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-source/01_clean_up"
      ],
      "source": "if exists(.\"timestamp\") {\n    ts = parse_timestamp!(.\"timestamp\", format: \"%+\")\n    .\"timestamp\" = format_timestamp!(ts, format: \"%+\", timezone: \"local\")\n}\n\nif exists(.\"timestamp_end\") {\n    ts = parse_timestamp!(.\"timestamp_end\", format: \"%+\")\n    .\"timestamp_end\" = format_timestamp!(ts, format: \"%+\", timezone: \"local\")\n}",
      "type": "remap"
    },
    "transform/source/test-source/03_parse_json": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-source/02_local_timezone"
      ],
      "source": "if !exists(.parsed_data) {\n    structured, err = parse_json(.message)\n    if err == null {\n        .parsed_data = structured\n    } else {\n        .parsed_data = .message\n    }\n}",
      "type": "remap"
    },
    "transform/source/test-source/04_log_filter": {
      "condition": "exists(.parsed_data.foo)",
      "inputs": [
        "transform/source/test-source/03_parse_json"
      ],
      "type": "filter"
    },
    "transform/source/test-source/05_log_filter": {
      "condition": "!exists(.parsed_data.fo)",
      "inputs": [
        "transform/source/test-source/04_log_filter"
      ],
      "type": "filter"
    },
    "transform/source/test-source/06_log_filter": {
      "condition": "if is_boolean(.parsed_data.foo) || is_float(.parsed_data.foo) {\n    data, err = to_string(.parsed_data.foo);\n    if err != null {\n        false;\n    } else {\n        includes([\"wvrr\"], data);\n    };\n} else if .parsed_data.foo == null {\n    \"null\";\n} else {\n    includes([\"wvrr\"], .parsed_data.foo);\n}",
      "inputs": [
        "transform/source/test-source/05_log_filter"
      ],
      "type": "filter"
    },
    "transform/source/test-source/07_log_filter": {
      "condition": "if is_boolean(.parsed_data.foo) || is_float(.parsed_data.foo) {\n    data, err = to_string(.parsed_data.foo);\n    if err != null {\n        true;\n    } else {\n        !includes([\"wvrr\"], data);\n    };\n} else if .parsed_data.foo == null {\n    \"null\";\n} else {\n    !includes([\"wvrr\"], .parsed_data.foo);\n}",
      "inputs": [
        "transform/source/test-source/06_log_filter"
      ],
      "type": "filter"
    },
    "transform/source/test-source/08_log_filter": {
      "condition": "match!(.parsed_data.foo, r'^wvrr$')",
      "inputs": [
        "transform/source/test-source/07_log_filter"
      ],
      "type": "filter"
    },
    "transform/source/test-source/09_log_filter": {
      "condition": "if exists(.parsed_data.foo) \u0026\u0026 is_string(.parsed_data.foo) {\n    matched = false\n    matched0, err = match(.parsed_data.foo, r'^wvrr$')\n    if err != null {\n        true\n    }\n    matched = matched || matched0\n    !matched\n} else {\n    true\n}",
      "inputs": [
        "transform/source/test-source/08_log_filter"
      ],
      "type": "filter"
    }
  },
  "sinks": {
    "destination/cluster/test-es-dest": {
      "type": "elasticsearch",
      "inputs": [
        "transform/destination/test-es-dest/02_del_parsed_data"
      ],
      "healthcheck": {
        "enabled": false
      },
      "endpoint": "http://192.168.1.1:9200",
      "encoding": {
        "timestamp_format": "rfc3339"
      },
      "batch": {
        "max_bytes": 10485760,
        "timeout_secs": 1
      },
      "auth": {
        "password": "secret",
        "strategy": "basic",
        "user": "elastic"
      },
      "tls": {
        "ca_file": "-----BEGIN CERTIFICATE-----\nMIICwzCCAasCFCjUspjyoopVgNr4tLNRKhRXDfAxMA0GCSqGSIb3DQEBCwUAMB4x\nCzAJBgNVBAYTAlJVMQ8wDQYDVQQDDAZUZXN0Q0EwHhcNMjEwNjIyMTE0NjA0WhcN\nNDgxMTA3MTE0NjA0WjAeMQswCQYDVQQGEwJSVTEPMA0GA1UEAwwGVGVzdENBMIIB\nIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3ln6SzVITuVweDTgytxL6NLC\nv+Zyg9wWiVYRVqcghOSAP2XRe2cMbiaNonOhem444dkBEcwxYhXeXAYA47WBHvQG\n+ZFK9oJiBMddiHZf5jTWZC+oJ+6L+HtGdx1K7s3Yh38iC2XtjzU9QBsfeBeJHzYY\neWrmLt6iN6Qt44cywPtJUowjjJiOXPv1z9nT7c/sF/9S1ElXCLWPytwJWSb0eDR+\na1FvgEKWqMarJrEm1iYXKSQYPajXOTShGioHMVC+es1nypszLoweBuV79I/VVv4a\ngVNBa70ibDqs7/w3q2wCb5fZADE832SrWHtcm/InJCkAKys0rI9f89PXyGoYMwID\nAQABMA0GCSqGSIb3DQEBCwUAA4IBAQC4oyj/utVQYkn6yu5Q0MneO+V/NSEHxjNr\nrWNfrnOcSWb8jAQZ3vdZGKQLUokhaSQCJBwarLbAiNUmntogtHDlKgeGqtgU7xVy\nIi1BJW5VLrz8L5GMDGPGcfR3iT7Jh5rzS5QG9aysTx/0jVhStO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YXyd5r+H+vI5elHpo+lUiagv4KbBklBCgD9e4WzdXW7qxI9csMOEMCgYEA1P9R\nxhF5Bh4eGWX7EmC0Tf2UCkOp91uAzPd3f4SPXydKlq02BkpBxVJdCvAW6ZTFgqMu\ntgPqF/+K4M7/HE+b88h7+VvBMU20tqn5c5CbtMGeIM81i/ulE89jRVv/24cxYF+C\niTtVpRxu4IMsNkvp04xB26uphG2NG7CUcfAtI/ECgYEArjXBvonNPDQnsiPVPqpe\nAIMaSw+JaD0kq7U9Zs3ktHC4RfcmdBcq+M7MX92YcAhveC4xae5Z/HSQE2nLm1FB\nsrtijuAFKbayhc3RiGv4uainqVszL652re5CjWX8fEniBdiDabIXqygYyVdwg42o\nNbGgrIxZLtOe3tdHFHtK94cCgYBqWCOq4bRsIoNiqPEnJtM/ETlluozU7IGtVGz8\nZOH0Xzi1bDvJ/i9CZrH/sQmvi9DlPbYnuGKbosHjJlZm+zRhDhsfz/jwNdzhSpI6\nadvj7ruVo/8XKggskOH+kkV3hNNZS7Zv8Aj9y+lr/PIJFfPj5GZJWDbl4JCQX6Ru\nEr1m8QKBgEItNIJKC8KMr2xVPcnj54LYgPobxQrKKNSgEC+E3dDV8LD26vGJfQcI\nL0lPO3VmoYdZBykiAt5CXG5/FK9JCSWCmSY1OFbbgXtx0FjF7sTG8+w+j8mnQ6VP\n7WqSZ053ewFxk/XIXcNwWAQD9nWg3WJMwQADSDgKGctQQW8DOwOV\n-----END RSA PRIVATE KEY-----\n",
        "verify_hostname": false,
        "verify_certificate": true
      },
      "compression": "gzip",
      "bulk": {
        "action": "index",
        "index": "logs-%F"
      },
      "pipeline": "testpipe",
      "mode": "bulk",
      "doc_type": "_doc",
      "suppress_type_name": false
    }
  }
}
